﻿using System;
using System.Collections.Generic;

using System.Text;

namespace TimKen.DataEntity
{
   
      	/// <summary>
	/// 订单集实体类 
	/// </summary>
	public class Order
	{
		public Order()
		{}
		#region Model
		private string _orderid;
		private string _shipaddress;
		private decimal? _freight;
		private string _currency;
		private decimal? _discount;
		private decimal _rate;
		private decimal _totalamount;
		private decimal _baseamount;
		private decimal _taxamount;
		private DateTime? _deliverydate;
		private DateTime? _expectdate;
		private string _orderno;
		private DateTime? _closedate;
		private string _remark;
		private int? _approvetype;
		private string _approveid;
		private DateTime? _approvetime;
		private bool _checkflag;
		private bool _confirmed;
		private  OrderStatus  _orderstatus;
		private int? _contractstatus;
		private int? _taxclassid;
		private  OrderType   _ordertype;
		private string _contactperson;
		private int? _salespersoncode;
		private string _country;
		private string _province;
		private string _city;
		private string _county;
		private string _telephone;
		private string _mobile;
		private string _fax;
		private string _creator;
		private DateTime _createdate;
		private string _cardcode;
		private string _billaddress;
		private int? _shiptype;
		private string _shiptocode;
        private string _billtocode;
        private string _email;
        private string _address;
        private int? _maxshipdays;
        private string _cntctcode;
        private string _CustomerForeignName;
        private string _CustomerName;
        public DateTime? _planDate;
		/// <summary>
		/// 系统自动产生的GUID
		/// </summary>
		public string OrderID
		{
			set{ _orderid=value;}
			get{return _orderid;}
		}

        public string CustomerForeignName
        {
            set { _CustomerForeignName = value; }
            get { return _CustomerForeignName; }
        }

        public string CustomerName
        {
            set { _CustomerName = value; }
            get { return _CustomerName; }
        }
		/// <summary>
		/// 送货地址
		/// </summary>
		public string ShipAddress
		{
			set{ _shipaddress=value;}
			get{return _shipaddress;}
		}
		/// <summary>
		/// 运费
		/// </summary>
		public decimal? Freight
		{
			set{ _freight=value;}
			get{return _freight;}
		}
		/// <summary>
		/// 交易币种：RMB等等
		/// </summary>
		public string Currency
		{
			set{ _currency=value;}
			get{return _currency;}
		}
		/// <summary>
		/// 折扣率:0.00~1.00
		/// </summary>
		public decimal? Discount
		{
			set{ _discount=value;}
			get{return _discount;}
		}
		/// <summary>
		/// 税率
		/// </summary>
		public decimal Rate
		{
			set{ _rate=value;}
			get{return _rate;}
		}
		/// <summary>
		/// 总金额（含税，含运费）
		/// </summary>
		public decimal TotalAmount
		{
			set{ _totalamount=value;}
			get{return _totalamount;}
		}
		/// <summary>
		/// 未税金额
		/// </summary>
		public decimal BaseAmount
		{
			set{ _baseamount=value;}
			get{return _baseamount;}
		}
		/// <summary>
		/// 税额
		/// </summary>
		public decimal TaxAmount
		{
			set{ _taxamount=value;}
			get{return _taxamount;}
		}
		/// <summary>
		/// 实际交货日期
		/// </summary>
		public DateTime? DeliveryDate
		{
			set{ _deliverydate=value;}
			get{return _deliverydate;}
		}



		/// <summary>
		/// 预计交货日期
		/// </summary>
		public DateTime? ExpectDate
		{
			set{ _expectdate=value;}
			get{return _expectdate;}
		}


        /// <summary>
        /// 计划交货日期
        /// </summary>
        public DateTime? PlanDate
        {
            set { _planDate = value; }
            get { return _planDate; }
        }






		/// <summary>
		/// 订单号码，系统自动产生
		/// </summary>
		public string OrderNo
		{
			set{ _orderno=value;}
			get{return _orderno;}
		}
		/// <summary>
		/// 结案日期
		/// </summary>
		public DateTime? CloseDate
		{
			set{ _closedate=value;}
			get{return _closedate;}
		}
		/// <summary>
		/// 备注
		/// </summary>
		public string Remark
		{
			set{ _remark=value;}
			get{return _remark;}
		}
		/// <summary>
		/// 订单审核方式，自动/人工，来源于系统参数设置
		/// </summary>
		public int? ApproveType
		{
			set{ _approvetype=value;}
			get{return _approvetype;}
		}
		/// <summary>
		/// 订单审核人
		/// </summary>
		public string ApproveID
		{
			set{ _approveid=value;}
			get{return _approveid;}
		}
		/// <summary>
		/// 审核时间：自动取系统时间
		/// </summary>
		public DateTime? ApproveTime
		{
			set{ _approvetime=value;}
			get{return _approvetime;}
		}
		/// <summary>
		/// 系统检核标志：检核通过/信用额不足/库存不足/信用额库存均不足
		/// </summary>
		public bool CheckFlag
		{
			set{ _checkflag=value;}
			get{return _checkflag;}
		}
		/// <summary>
		/// 确认码：Y-已确认/N-未确认
		/// </summary>
		public bool Confirmed
		{
			set{ _confirmed=value;}
			get{return _confirmed;}
		}
		/// <summary>
		/// 订单状态：SORequest/SO/未发货/已发货/已拒绝
		/// </summary>
		public  OrderStatus  OrderStatus
		{
			set{ _orderstatus=value;}
			get{return _orderstatus;}
		}
        /// <summary>
        /// 订单状态文本信息绑定用
        /// </summary>
        public string Status
        {
            get;
            set;
        }
		/// <summary>
		/// 合同状态位
		/// </summary>
		public int? ContractStatus
		{
			set{ _contractstatus=value;}
			get{return _contractstatus;}
		}
		/// <summary>
		/// 税种类别
		/// </summary>
		public int? TaxClassID
		{
			set{ _taxclassid=value;}
			get{return _taxclassid;}
		}
		/// <summary>
		/// 0为OrderRequest，1为Order
		/// </summary>
		public  OrderType OrderType
		{
			set{ _ordertype=value;}
			get{return _ordertype;}
		}
		/// <summary>
		/// 联系人
		/// </summary>
		public string ContactPerson
		{
			set{ _contactperson=value;}
			get{return _contactperson;}
		}
		/// <summary>
		/// 业务员编码
		/// </summary>
		public int? SalesPersonCode
		{
			set{ _salespersoncode=value;}
			get{return _salespersoncode;}
		}
		/// <summary>
		/// 国家
		/// </summary>
		public string Country
		{
			set{ _country=value;}
			get{return _country;}
		}
		/// <summary>
		/// 省份
		/// </summary>
		public string Province
		{
			set{ _province=value;}
			get{return _province;}
		}
		/// <summary>
		/// 城市
		/// </summary>
		public string City
		{
			set{ _city=value;}
			get{return _city;}
		}
		/// <summary>
		/// 县
		/// </summary>
		public string County
		{
			set{ _county=value;}
			get{return _county;}
		}
		/// <summary>
		/// 联系电话
		/// </summary>
		public string Telephone
		{
			set{ _telephone=value;}
			get{return _telephone;}
		}
		/// <summary>
		/// 手机号码
		/// </summary>
		public string Mobile
		{
			set{ _mobile=value;}
			get{return _mobile;}
		}
		/// <summary>
		/// 传真号码
		/// </summary>
		public string Fax
		{
			set{ _fax=value;}
			get{return _fax;}
		}
		/// <summary>
		/// 创建者，订单申请人
		/// </summary>
		public string Creator
		{
			set{ _creator=value;}
			get{return _creator;}
		}
		/// <summary>
		/// 订单创建日期
		/// </summary>
		public DateTime CreateDate
		{
			set{ _createdate=value;}
			get{return _createdate;}
		}
		/// <summary>
		/// 客户代号，取自于Customer.CardCodeID,该编号来源于B1
		/// </summary>
		public string CardCode
		{
			set{ _cardcode=value;}
            get{return _cardcode;}
		}


        public int CustomerID
        {
            get;
            set;
        }
		/// <summary>
		/// 账单地址
		/// </summary>
		public string BillAddress
		{
			set{ _billaddress=value;}
			get{return _billaddress;}
		}
		/// <summary>
		/// 运输方式：与TransType.TransTypeID相关联
		/// </summary>
		public int? ShipType
		{
			set{ _shiptype=value;}
			get{return _shiptype;}
		}
		/// <summary>
		/// 送达地编号
		/// </summary>
		public string ShipToCode
		{
			set{ _shiptocode=value;}
			get{return _shiptocode;}
		}

        /// <summary>
        /// 账单地编号
        /// </summary>
        public string BillToCode
        {
            set { _billtocode = value; }
            get { return _billtocode; }
        }

        public int? MaxShipDays
        {
            set {
                _maxshipdays = value;
            }
            get {
                return _maxshipdays;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public string CntctCode
        {
            set { _cntctcode = value; }
            get { return _cntctcode; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Email
        {
            set { _email = value; }
            get { return _email; }
        }
        /// <summary>
        /// 
        /// </summary>
        public string Address
        {
            set { _address = value; }
            get { return _address; }
        }


        public string ContractTerm
        {
            get;
            set;
        }

        public string SAPSoNo { get; set; }
        public string ContractId { get; set; }

        private IList<OrderItem> list = new List<OrderItem>();
        public IList<OrderItem> OrderItems
        {
            get { return list; }
            set { list = value; }
        }
        #endregion Model

    }

    /*
     * 所有的订单状态包括
     * 1- Passed审核通过，待发货；
     * 2-For B1 Check等待B1审核; 
     * 3-Partial Shipment已部分发货；
     * 4-Complete Shipment已完全发货; 
     * 5-Cancel 已取消
     * 6-B1 Cancel已被B1取消; 
     * 7-For FirstBridge SO Freight Confirm 等待FirstBridge订单运输信息确认; 发生更新的情况有：
     * 9--确认付款
     */

    public enum OrderStatus 
    {
        Pass=1,
        ForB1Check,
        PartialShipment,
        CompleteShipment,
        Cancel,
        B1Cancel,
        ForFirstBridgeSOFreightConfirm,
        ConfirmPayment,
        CustomerConfirmed
    }



 
    
    public enum OrderType { 
        OrderRequest,
        Order
    }


   
}
